package com.exchange.dto;

import com.exchange.entity.GiftCard;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;

@Data
public class GiftCardDto {
    private Long id;
    private Long merchantId;
    private String cardName;
    private String cardCode;
    private String description;
    private BigDecimal price;
    private BigDecimal discountPercentage;
    private LocalDate validityStartDate;
    private LocalDate validityEndDate;
    private LocalDateTime createdAt;
    private LocalDateTime updatedAt;
    
    public static GiftCardDto fromEntity(GiftCard giftCard) {
        GiftCardDto dto = new GiftCardDto();
        dto.setId(giftCard.getId());
        dto.setMerchantId(giftCard.getMerchantId());
        dto.setCardName(giftCard.getCardName());
        dto.setCardCode(giftCard.getCardCode());
        dto.setDescription(giftCard.getDescription());
        dto.setPrice(giftCard.getPrice());
        dto.setDiscountPercentage(giftCard.getDiscountPercentage());
        dto.setValidityStartDate(giftCard.getValidityStartDate());
        dto.setValidityEndDate(giftCard.getValidityEndDate());
        dto.setCreatedAt(giftCard.getCreatedAt());
        dto.setUpdatedAt(giftCard.getUpdatedAt());
        return dto;
    }
}